package com.oracle.application.service.impl;

import com.oracle.application.Fegin.MemberFegin;
import com.oracle.application.Fegin.vo.Member;
import com.oracle.application.service.MemberService;
import com.oracle.application.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MemberServiceImpl implements MemberService {
    @Autowired
    private MemberFegin memberFegin;

    @Override
    public R<Member> login(String loginname, String loginpwd) {
        R<Member> memberPro = memberFegin.getMemberByLoginName(loginname);
        if (memberPro.getData()==null){
            return new R<Member>(201,"账号不存在",null);
        }
        if (!memberPro.getData().getLoginpwd().equals(loginpwd)){
            return new R<Member>(202,"密码错误",null);
        }
        memberPro.getData().setLoginpwd("");
        return new R<Member>(200,"success",memberPro.getData());
    }
}
